/*This file is part of BinaryReaderCP.

 *  BinaryReaderCP is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

 *  BinaryReaderCP is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

 *  You should have received a copy of the GNU General Public License
    along with BinaryReaderCP.  If not, see <http://www.gnu.org/licenses/>.
		
	Author: calc0000
*/
#ifndef __BINARYREADER_H
#define __BINARYREADER_H

#include <string>
#include <fstream>

class BinaryReader{
protected:
	FILE*			filePointer;
	long			length;
	std::ifstream*	fileStream;
	long			pos;
public:
	BinaryReader			(FILE* fp);
	BinaryReader			(const char* fPath);
	BinaryReader			();
	bool					Opened();
	void					Close();
	//Position fxns
	long					Position();
	void					Position(long p);
	void					IncPosition(long c);
	bool					_EOF();
	//Reading functions
	signed char				ReadSByte();
	short					ReadInt16();
	int						ReadInt32();
	float					ReadSingle();
	double					ReadDouble();
	unsigned short			ReadUInt16();
	unsigned int			ReadUInt32();
	unsigned char			ReadByte();
	std::string				ReadChars(int count);
	std::string				ReadNullString();
	long long					ReadInt64();
	unsigned long long		ReadUInt64();
	long					Length();
	int						_fread(void* ptr,int size,int count);
};

#endif